export default function (global, console) {
  global.showLocalStorage = function () {
    if (localStorage.length) {
      const keys = Object.keys(localStorage)
      const storage = {}
      keys.forEach((key) => {
        try {
          storage[key] = JSON.parse(localStorage[key])
        } catch {
          storage[key] = decodeURIComponent(localStorage[key])
        }
      })
      const storageTable = keys.map((key) => ({
        Key: key,
        Value: decodeURIComponent(localStorage[key]),
      }))

      console.group('Cookies')
      console.log(storage)
      console.table(storageTable)
      console.groupEnd('Cookies')
    } else {
      console.log('localStorage is empty.')
    }
  }
}
